﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
using Volo.Abp;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;

namespace Vouchers
{
    [Comment("入库单")]
    [Table("t_instockvoucher")]
    [Index(nameof(VoucherCode))]
    public class InStockVoucher : VoucherBase
    {
        public InStockVoucher(Guid keyId)

        {
            this.Id = keyId;
        }

        public InStockVoucher()
        {

        }
        public void SetId(Guid id)
        {
            this.Id = id;
        }

        /// <summary>
        /// 单据类型 0 常规入库 1 直入直出
        /// </summary>
        [Comment("单据类型 0 常规入库 1 直入直出")]
        public int VoucherType { get; set; }

        /// <summary>
        /// 供应商ID
        /// </summary>
        [Comment("供应商ID")]
        public Guid SupplierId { get; set; }

        /// <summary>
        /// 供应商名称
        /// </summary>
        [Comment("供应商名称")]
        [MaxLength(200)]
        public string SupplierName { get; set; }

        /// <summary>
        /// 仓库Id
        /// </summary>
        [Comment("仓库Id")]
        public Guid WarehouseId { get; set; }

        /// <summary>
        /// 仓库名称
        /// </summary>
        [Comment("仓库名称")]
        [MaxLength(100)]
        public string WarehouseName { get; set; }

        [Comment("领用科室Id")]
        public Guid ReceiveDeptId { get; set; }

        [Comment("领用科室名称")]
        [MaxLength(100)]
        public string ReceiveDeptName { get; set; }


        [Comment("产品小类Id")]
        public Guid ProductMinClassId { get; set; }

        [Comment("产品小类 名称")]
        [MaxLength(50)]
        public string ProductMinClassName { get; set; }

        [Comment("采购员")]
        [MaxLength(50)]
        public string Purchaser { get; set; }




        /// <summary>
        /// 验收人 
        /// </summary>
        [Comment("验收人")]
        [MaxLength(50)]
        public string WarehousedBy { get; set; }

        /// <summary>
        /// 验收时间
        /// </summary>
        [Comment("验收时间")]
        public DateTime? WarehousedOn { get; set; }

        /// <summary>
        /// 复验人 
        /// </summary>
        [Comment("复验人")]
        [MaxLength(50)]
        public string ReinspectionBy { get; set; }

        /// <summary>
        /// 复验时间
        /// </summary>
        [Comment("复验时间")]
        public DateTime? ReinspectionOn { get; set; }

        /// <summary>
        /// 验收意见
        /// </summary>
        [Comment("验收意见")]
        [MaxLength(200)]
        public string AcceptanceOpinions { get; set; }


        [MaxLength(50)]
        [Comment("入库类别(1-采购入库、2-捐赠入库、3-科研入库)")]
        public int VoucherClass { get; set; }
        

        public void ResetId(Guid id)
        {
            this.Id = id;
        }

 
        public Guid? OrderVoucherId { get; set; }

        [MaxLength(100)]
        public string OrderVoucherCode { get; set; }


        [MaxLength(500)]
        [Comment("拒收原因")]
        public string NoInStockReason { get; set; }

        #region 手术跟台（高值非备货使用）


        [Comment("申请单Id")]
        public Guid? ApplyOrderVoucherId { get; set; }

        [Comment("申请单编号")]
        [MaxLength(100)]
        public string ApplyOrderVoucherCode { get; set; }

 
        [Comment("申请科室Id")]
        public Guid? ApplyDeptId { get; set; }


        [Comment("申请科室名称")]
        [MaxLength(100)]
        public string ApplyDeptName { get; set; }


        [Comment("是否骨科材料管理")]
        public bool? IsOperationHeel { get; set; }



        #endregion

        [MaxLength(100)]
        [Comment("销售单号")]
        public string SellVoucherCode { get; set; }

        [MaxLength(100)]
        [Comment("出库单号")]
        public string OutStockVoucherCode { get; set; }

        [Comment("管理方式：0---数量管理; 1---定数管理")]
        public int ProductManageType { get; set; }

        [Comment("代理商Id")]
        public Guid? AgentId { get; set; }

        [MaxLength(200)]
        [Comment("代理商名称")]
        public string AgentName { get; set; }

        [Comment("记账状态(0:未记账 1:已记账)")]
        public int? AccountingStatus { get; set; } = -1;

        [MaxLength(2000)]
        [Comment("入库单凭证")]
        public string DocumentAnnex { get; set; }

        [Comment("科研负责人姓名")]
        [MaxLength(50)]
        public string ResearchMaterialsLeaderName { get; set; }

        [Comment("科研负责人ID")]
        public Guid? ResearchMaterialsLeaderId { get; set; }

        [Comment("科研项目ID")]
        public Guid? ResearchMaterialsProjectId { get; set; }

        [Comment("是否是定数直入直出单；1：是，0：否")]
        public bool IsBarCodeDirect { get; set; }

        [Comment("后台验收处理状态：0未处理，1处理中，2成功，3失败")]
        public int? BackgroundStatus { get; set; } = 0;

        [Comment("后台验收处理备注")]
        [MaxLength(500)]
        public string BackgroundRemark { get; set; }

        [Comment("标签打印状态（0:未打印，1:部分打印，2:已打印）")]
        public int TagPrintStatus { get; set; } = 0;

        [Comment("RFID打印状态（0:未打印，1:部分打印，2:已打印）")]
        public int RFIDPrintStatus { get; set; } = 0;


        [Comment("当前OMS提取入库单，是否存在驳回数量（0:否，1:是）")]
        public int IsRejectCount { get; set; } = 0;


        [Comment("是否集采 0-未集采，1-集采")]
        public int IsCollect { get; set; } = 0;

        [Comment("时间戳字段")]
        public DateTime? SyncTimeStamp { get; set; }

    }
}
